<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  const person = {
    name: '张三',
    age: 18
  }

  // 实现自己的call方法
  Function.prototype.myCall = function (thisArg, ...args) {
    const key = Symbol('key')
    thisArg[key] = this
    const result = thisArg[key](...args)
    delete thisArg[key]
    return result
  }

  // 使用cal
  function test(a, b) {
    console.log(this)
    console.log(a, b)
    return a + b
  }

  const result = test.myCall(person, 1, 2)
  console.log(result)
</script>
</body>
</html>